package com.rp.system.user.controller;

import com.rp.common.result.ResultDTO;
import com.rp.common.utils.NullIs;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * 类说明:
 *
 * @author ****
 * @date 2020-06-20 16:23  新建
 */
@RestController
@RequestMapping("/redirect")
@ApiIgnore
public class RedirectController {

    /**
     * @Author HuJingYu
     * @Date 10:22 2020-12-23
     * @Description 访问受限
     * @param time 受限时长
     * @return ResultDTO
     */
    @GetMapping("/accessRestricted")
    public ResultDTO acc(String time) {
        return ResultDTO.ACCESS_RESTRICTED().message("访问过于频繁，已被限制=> 倒计时:" + time);
    }

    /**
     * @Author HuJingYu
     * @Date 10:22 2020-12-23
     * @Description 未登录状态
     * @param kickout 1表示被挤下线
     * @return ResultDTO
     */
    @GetMapping(value = "/loginIN")
    public ResultDTO loginIN(Integer kickout) {
        if(!NullIs.isEmpty(kickout) && kickout==1){
            return ResultDTO.LOG_IN_TO_AN_ACCOUNT_SOMEWHERE_ELSE();
        }
        return ResultDTO.USER_NOT_LOGGED_IN();
    }

}
